#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int isprime(int x)
{
    for (int i = 2; i <= sqrt(x); ++i)
    {
        if (x % i == 0)
            return false;
    }
    return true;
}
int main()
{
    int n;
    cin >> n;

    int a, b, ret1, ret2;
    for (int i = n / 2; i > 0; --i)
    {
        if (isprime(i) && isprime(n - i))
        {
            a = i;
            b = n - i;
            break;
        }
    }
    cout << a << endl << b << endl;
    return 0;
}